from rest_framework import serializers
from publicHealth.models import PublicHealthDirection, PublicHealthClassification, PublicHealthArticles

# 大众健康方向序列化器
class PublicHealthDirectionSerializer(serializers.ModelSerializer):
    class Meta:
        model = PublicHealthDirection
        fields = [
            'id', 
            'name'
        ]

# 大众健康分类序列化器
class PublicHealthClassificationSerializer(serializers.ModelSerializer):
    class Meta:
        model = PublicHealthClassification
        fields = [
            'id', 
            'name', 
            'health_direction',
            'publicHealth_articles'
        ]

# 大众健康文章序列化器
class PublicHealthArticlesSerializer(serializers.ModelSerializer):
    class Meta:
        model = PublicHealthArticles
        fields = [
            'id', 
            'title', 
            'content', 
            'author', 
            'publish_date', 
            'image'
        ]